<template>
  <view>
    <view class="comt">
      <view class="cent-bo">
        <view class="cent-bo-b" v-for="(item,index) in jijinInfo" :key="item.id" @click="investcli(item.id,item.project_name)">
          <view class="cent-bo-b-l">
            <image
              :src="item.image"
              mode=""
              class="cent-bo-b-img"></image>
          </view>
          <view class="cent-bo-b-r">
            <view class="cent-bo-b-r-t u-ellipsis-1" style="    width: 58vw;">
              <view class="cent-bo-b-l  u-ellipsis-1" style="    width: 58vw;">
                {{item.project_name}}
                <view class="cent-bo-b-r"></view>
              </view>
            </view>
            <view class="cent-bo-b-r-b u-ellipsis-2" style="    width: 58vw;" v-html="item.project_desc"></view>
          </view>
        </view>
      </view>
    </view>
	  <u-loadmore :status="loadingType" class="u-p-b-80"></u-loadmore>
  </view>
</template>

<script>
import http from "@/shopro/request/index.js";
export default {
  data() {
    return {
        jijinInfo: [],
		project_type:'',
	    page: 1, //分页加载
	    loadingType: 'more', //加载更多状态
    };
  },
  onLoad(option) {
   
	this.project_type= option.type;
	this.cityLists()
	},
  methods: {
    investcli(id,name) {
	    uni.setStorageSync("pageName",name)
      uni.navigateTo({
        url: "/pages/index/city_path/invest?id="+id,
      });
    },
      cityLists(type = 'add', loading) {
	      if (type === 'add') {
		      if (this.loadingType === 'nomore') {
			      return;
		      }
		      this.loadingType = 'loading';
	      } else if (type === 'refresh') {
		      this.loadingType = 'loading';
		      this.page = 1;
		      this.projectData = [];
	      } else {
		      this.loadingType = 'more';
	      }
	      
	      let formData = {
		      page: this.page,
		      token: uni.getStorageSync('token'),
		      project_type:this.project_type
	      };
        http("city.cityLists", formData)
          .then((res) => {
	          let zhishiList = res.data.data;
	          this.page++;
	          this.jijinInfo = this.jijinInfo.concat(zhishiList);
	          this.loadingType = res.data.current_page >= res.data.last_page ? 'nomore' : 'more';
          })
          .catch((err) => {});
      },
  },
	//加载更多
	onReachBottom() {
		this.cityLists();
	}
};
</script>

<style lang="scss">
page {
  background: #f7f7f7;
}

.comt {
  padding: 0 30rpx;
  .fonts {
    margin: 20rpx 0;
    .font {
      width: 100%;
      height: 300rpx;
      border-radius: 16rpx;
    }
  }

  .cent-bo {
    margin-top: 4rpx;
    .cent-bo-b {
      height: 200rpx;
      background: #ffffff;
      border-radius: 16rpx;
      margin-top: 20rpx;
      display: flex;

      .cent-bo-b-l {
        .cent-bo-b-img {
          width: 200rpx;
          height: 140rpx;
          margin: 30rpx 21rpx;
        }
      }

      .cent-bo-b-r {
        .cent-bo-b-r-t {
          margin-top: 30rpx;
          margin-bottom: 35rpx;

          .cent-bo-b-l {
            font-family: PingFang;
            font-weight: bold;
            font-size: 32rpx;
            color: #000000;
            line-height: 30rpx;
            display: flex;

            .cent-bo-b-r {
              margin-left: 25rpx;
            }
          }

          .cent-bo-b-r-b {
            font-family: PingFang;
            font-weight: 500;
            font-size: 30rpx;
            color: #666666;
            line-height: 42rpx;
          }
        }
      }
    }
  }
}
</style>
